# 实现一个简单的QLearning算法
# 0----------T
# 0为勇士，T为宝藏，训练勇士去找到宝藏
# -----------Y
# 勇士找到宝藏




PATHLEN=30

class Man:
    position=0
    def __init__(self):
        self.position=0

    def move_left(self):
        if self.position==0:
            return False
        else:
            self.position-=1
            return True

    def move_right(self):
        if self.position==PATHLEN-1:
            return False
        else:
            self.position+=1
            return True

    def win(self):
        if self.position==PATHLEN-1:
            return True
        else:
            return False

    def status(self):
        return self.position


# 输出地图
def showMap(man):
    for i in range(PATHLEN):
        if i==PATHLEN-1 and man.position==PATHLEN-1:
            print('Y',end='')
        elif i==man.position:
            print('0', end='')
        elif i==PATHLEN-1:
            print('T', end='')
        else:
            print('-', end='')
    print()




def train():
    pass







if __name__ == "__main__":
    man=Man()
    showMap(man)
